package reno.ribbon.ribbon.warframemarket;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import reno.ribbon.ribbon.common.JSONUtils;

@Service
public class WarframeMarketService {

    @Autowired
    RestTemplate restTemplate;

//    @HystrixCommand(fallbackMethod = "getWarframeMarketError")
    public JSONObject getWarframeMarket(String itemCn) {
        return restTemplate.getForObject("http://market/getWarframeMarket" + "?itemCn=" + itemCn, JSONObject.class);
    }

    public JSONObject getWarframeMarketError(String itemCn) {
        return JSONUtils.failure("Sorry,Service invocation failed.");
    }

}
